// 品牌数据
const brandsData = [
  // 蔬菜类
  {
    "name": "每日鲜",
    "category": "蔬菜",
    "is_active": true,
    "is_own_brand": true,
    "aliases": ""
  },
  {
    "name": "缤纷田园",
    "category": "蔬菜",
    "is_active": true,
    "is_own_brand": true,
    "aliases": ""
  },
  {
    "name": "小汤山",
    "category": "蔬菜",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  
  // 粮油类
  {
    "name": "良食记",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": true,
    "aliases": ""
  },
  {
    "name": "福临门",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "金龙鱼",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "鲁花",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "长寿花",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "欧丽薇兰",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "胡姬花",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "香满园",
    "category": "粮油",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  
  // 日用品类
  {
    "name": "唯本生活",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": true,
    "aliases": ""
  },
  {
    "name": "海飞丝",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Head & Shoulders"
  },
  {
    "name": "潘婷",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Pantene"
  },
  {
    "name": "飘柔",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "清扬",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "CLEAR"
  },
  {
    "name": "力士",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "LUX"
  },
  {
    "name": "舒肤佳",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Safeguard"
  },
  {
    "name": "高露洁",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Colgate"
  },
  {
    "name": "佳洁士",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Crest"
  },
  {
    "name": "蓝月亮",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "奥妙",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "OMO"
  },
  {
    "name": "汰渍",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Tide"
  },
  {
    "name": "碧浪",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Ariel"
  },
  {
    "name": "立白",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "超能",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "金纺",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Comfort"
  },
  {
    "name": "茶花",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "乐扣乐扣",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Lock&Lock"
  },
  {
    "name": "苏泊尔",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "SUPOR"
  },
  {
    "name": "美的",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Midea"
  },
  {
    "name": "恒源祥",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "南极人",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": ""
  },
  {
    "name": "帮宝适",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Pampers"
  },
  {
    "name": "花王",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Kao"
  },
  {
    "name": "好奇",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Huggies"
  },
  {
    "name": "惠氏",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Wyeth"
  },
  {
    "name": "美赞臣",
    "category": "日用品",
    "is_active": true,
    "is_own_brand": false,
    "aliases": "Mead Johnson"
  }
];

// 批量导入品牌函数
async function importBrands() {
  try {
    const response = await fetch('/api/config/brand-config/bulk', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ items: brandsData })
    });
    
    const result = await response.json();
    console.log('品牌导入结果:', result);
    return result;
  } catch (error) {
    console.error('品牌导入失败:', error);
    return null;
  }
}

// 执行导入
console.log('开始导入品牌数据...');
importBrands().then(result => {
  if (result) {
    console.log(`导入完成! 成功导入 ${result.created_count || 0} 个品牌`);
    if (result.error_count > 0) {
      console.warn(`有 ${result.error_count} 个品牌导入失败`);
    }
  } else {
    console.error('导入过程中发生错误');
  }
}); 